home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / misc / dspice0s / alfnum.c < prev    next >
C/C++ Source or Header  |  1992-11-21  |  4KB  |  141 lines

  1. /* alfnum.f -- translated by f2c (version of 3 February 1990  3:36:42).
  2.    You must link the resulting object file with the libraries:
  3.     -lF77 -lI77 -lm -lc   (in that order)
  4. */
  5.  
  6. #include "f2c.h"
  7.  
  8. /* Table of constant values */
  9.  
  10. static integer c__1 = 1;
  11.  
  12. /*<       subroutine alfnum(number,string,ipos) >*/
  13. /* Subroutine */ int alfnum_(number, string, ipos)
  14. integer *number;
  15. doublereal *string;
  16. integer *ipos;
  17. {
  18.     /* Initialized data */
  19.  
  20.     static struct {
  21.     char e_1[80];
  22.     doublereal e_2;
  23.     } equiv_9 = { {'0', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '1', ' ', ' ', 
  24.         ' ', ' ', ' ', ' ', ' ', '2', ' ', ' ', ' ', ' ', ' ', ' ', 
  25.         ' ', '3', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '4', ' ', ' ', 
  26.         ' ', ' ', ' ', ' ', ' ', '5', ' ', ' ', ' ', ' ', ' ', ' ', 
  27.         ' ', '6', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '7', ' ', ' ', 
  28.         ' ', ' ', ' ', ' ', ' ', '8', ' ', ' ', ' ', ' ', ' ', ' ', 
  29.         ' ', '9', ' ', ' ', ' ', ' ', ' ', ' ', ' '}, 0. };
  30.  
  31. #define adigit ((doublereal *)&equiv_9)
  32.  
  33.     static struct {
  34.     char e_1[8];
  35.     doublereal e_2;
  36.     } equiv_10 = { {'-', ' ', ' ', ' ', ' ', ' ', ' ', ' '}, 0. };
  37.  
  38. #define aminus (*(doublereal *)&equiv_10)
  39.  
  40.  
  41.     extern /* Subroutine */ int move_();
  42.     static integer istop, idigit;
  43.     static doublereal tmpdgt;
  44.     static integer istart, numtmp, num;
  45.  
  46.     /* Parameter adjustments */
  47.     --string;
  48.  
  49.     /* Function Body */
  50. /*<       implicit double precision (a-h,o-z) >*/
  51.  
  52. /*     this routine converts number into character form, storing the */
  53. /* characters in the character array string, beginning with the position 
  54. */
  55. /* indicated by ipos. */
  56.  
  57. /* **** note that the 'ipos' variable is changed to indicate the position 
  58. */
  59. /*      of the next unwritten character.  this could clobber constants if 
  60. */
  61. /*      ipos is not a variable in the calling program */
  62.  
  63. /*<       dimension string(1) >*/
  64. /*<       dimension adigit(10) >*/
  65. /*<       data adigit / 1h0,1h1,1h2,1h3,1h4,1h5,1h6,1h7,1h8,1h9 / >*/
  66. /*<       data aminus / 1h- / >*/
  67.  
  68.  
  69. /*<       num=number >*/
  70.     num = *number;
  71.  
  72. /*  check for number < 0 */
  73.  
  74. /*<       if (num.ge.0) go to 10 >*/
  75.     if (num >= 0) {
  76.     goto L10;
  77.     }
  78. /*<       num=-num >*/
  79.     num = -num;
  80. /* ...  negative number:  insert minus sign */
  81. /*<       call move(string,ipos,aminus,1,1) >*/
  82.     move_(&string[1], ipos, &aminus, &c__1, &c__1);
  83. /*<       ipos=ipos+1 >*/
  84.     ++(*ipos);
  85.  
  86. /*  convert number one digit at a time, in reverse order */
  87.  
  88. /*<    10 istart=ipos >*/
  89. L10:
  90.     istart = *ipos;
  91. /*<    20 numtmp=num/10 >*/
  92. L20:
  93.     numtmp = num / 10;
  94. /*<       idigit=num-numtmp*10 >*/
  95.     idigit = num - numtmp * 10;
  96. /*<       call move(string,ipos,adigit(idigit+1),1,1) >*/
  97.     move_(&string[1], ipos, &adigit[idigit], &c__1, &c__1);
  98. /*<       ipos=ipos+1 >*/
  99.     ++(*ipos);
  100. /*<       num=numtmp >*/
  101.     num = numtmp;
  102. /*<       if (num.ne.0) go to 20 >*/
  103.     if (num != 0) {
  104.     goto L20;
  105.     }
  106. /*<       istop=ipos-1 >*/
  107.     istop = *ipos - 1;
  108.  
  109. /*  now reverse the order of the digits */
  110.  
  111. /*<    30 if (istop.le.istart) go to 40 >*/
  112. L30:
  113.     if (istop <= istart) {
  114.     goto L40;
  115.     }
  116. /*<       call move(tmpdgt,1,string,istart,1) >*/
  117.     move_(&tmpdgt, &c__1, &string[1], &istart, &c__1);
  118. /*<       call move(string,istart,string,istop,1) >*/
  119.     move_(&string[1], &istart, &string[1], &istop, &c__1);
  120. /*<       call move(string,istop,tmpdgt,1,1) >*/
  121.     move_(&string[1], &istop, &tmpdgt, &c__1, &c__1);
  122. /*<       istart=istart+1 >*/
  123.     ++istart;
  124. /*<       istop=istop-1 >*/
  125.     --istop;
  126. /*<       go to 30 >*/
  127.     goto L30;
  128.  
  129. /*  conversion complete */
  130.  
  131. /*<    40 return >*/
  132. L40:
  133.     return 0;
  134. /*<       end >*/
  135. } /* alfnum_ */
  136.  
  137. #undef aminus
  138. #undef adigit
  139.  
  140.  
  141.